package com.cloudfun.campusshare.configuration.jpa.restriction.support;

import com.cloudfun.campusshare.configuration.jpa.restriction.PredicateSingleValueSupport;
import com.cloudfun.campusshare.configuration.jpa.util.RestrictionNames;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;

/**
 * @author 王溪源
 * @ClassName: LLikeRestriction
 * @Description: TODO
 * @Date 2020/8/10 16:26
 **/
public class LLikeRestriction extends PredicateSingleValueSupport {
    @Override
    public Predicate build(Path path, Object value, CriteriaBuilder builder) {
        return builder.like (path, "%" + value);
    }

    @Override
    public String getRestrictionName() {
        return RestrictionNames.LLIKE;
    }
}
